package com.lglbc;

import com.lglbc.hello.Hello;
import com.lglbc.hello.HelloAPIGrpc;
import io.grpc.ManagedChannel;
import io.grpc.ManagedChannelBuilder;

public class HelloClient {
    public static void main(String[] args) {
        ManagedChannel channel = ManagedChannelBuilder.forAddress("localhost", 9090).usePlaintext().build();
        HelloAPIGrpc.HelloAPIBlockingStub stub = HelloAPIGrpc.newBlockingStub(channel);
        Hello.HelloRequest request = Hello.HelloRequest.newBuilder().setName("乐哥聊编程").build();
        Hello.HelloReply response = stub.sayHello(request);
        System.out.println("调用结果: " + response.getMessage());
        channel.shutdown();
    }
}